<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"  scrolling="no">
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=Edge"/>

    <script type="text/javascript" src="js/jquery-2.1.4.min.js"></script>
    <script type="text/javascript" src="js/ace.js"></script>
    <script type="text/javascript" src="js/bootstrap.js"></script>
    <link rel="stylesheet" href="css/bootstrap.css"/>
    <link rel="stylesheet" href="css/font-awesome.min.css"/>
    <link rel="stylesheet" href="css/ace.css"/>
    <link rel="stylesheet" href="css/ace-ie.css"/>


    <style type="text/css">
        html {
            position: static;
            min-height: none;
        }

        .btn {
            border-radius: 4px;
        }

        .modal-content {
            border-radius: 7px;
        }
        .block{
            display: block;
        }
        .click-able{
            float: right;cursor: pointer;
            margin-right: 15px;
        }
        #new-link-btn{
            text-align: center;
        }
        .none-decoration{
            text-decoration: none!important;
        }
        .inner-block{
            display: inline-block;
        }
        .entity-group .row .col-sm-2{
            width: 15%;
        }
        .check-row{
            padding-left: 5%;
        }

        .main-content {
            margin: 0;
        }

        .java-type-ul{
            height: 120px;
            overflow-y: scroll;
        }
        .java-type-line{
            margin-top: 5px;
        }
        .row{
            margin-bottom: 5px;
            margin-top: 5px;
        }
        .row .entity-group .check-row .col-sm-2{
            width: 12%;
        padding-left:0 ;
        padding-right:0 ;
        }

        .row .entity-group .check-row .exclude{
            width: 30%;
        }

        .check-row label{
            margin-bottom: 10px;
        }
        #page-content{
            overflow-y: scroll;
            overflow-x: hidden;
        }
        .pagecontent label{
            padding-right: 0;
        }
        a:hover{cursor:pointer }
    </style>

    <title>菜单管理</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <script type="text/javascript" th:inline="javascript">


        $(function() {

            $(document).on("click",".java-type",function () {
                $(".java-type-ul").addClass("hidden");
                $(this).parent().find(".java-type-ul").removeClass("hidden");
                return false;

            });

            $(document).on("click",".java-type-li",function () {
                var javaTypeId = $.trim($(this).find(".java-type-li-text").attr("target"));
                var javaType =  $.trim($(this).find(".java-type-li-text").text());
                $(this).parent().parent().find(".java-type").text(javaType);
                $(this).parent().parent().find("input[type='hidden']").val(javaTypeId);
                $(this).parent().addClass("hidden");
                return false;

            });

            $(document).on("click","#mapping-modal",function () {
                $(".java-type-ul").addClass("hidden");
                return false;
            });

            $(document).on("click",".a-level-1",function () {
                var parent = $(this).parent();
                if ($(parent).hasClass("active")){ //闭合
                    $(parent).children(".ul-level-2").removeClass("block");
                    $(parent).removeClass("active");
                    $(parent).find(".li-lsaveSettingsCallbackevel-2").removeClass("active");
                    $(this).find("b").removeClass("icon-angle-right").addClass("icon-angle-down");
                    var html = "<option value=''>没有配置</option>";
                    $("#choose-settings-select").html(html);
                    return;
                }

                //展開
                $(parent).children(".ul-level-2").addClass("block");
                $(parent).addClass("active");
                $(parent).parent().parent().find(".can-check").removeClass("icon-check").addClass("icon-check-empty");
                $(parent).parent().siblings().find(".li-level-1").removeClass("active");
                $(parent).parent().siblings().find(".ul-level-2").removeClass("block");
                $(this).find("b").removeClass("icon-angle-down").addClass("icon-angle-right");
                var id = $(this).attr("link-id");
                console.log(id);
                $("#settings-link-id").val(id);
                loadDatabases(id);
                loadDefaultMappings(id);
            });

            $(document).on("click",".a-level-2",function () {
                var parent = $(this).parent();
                if ($(parent).hasClass("active")){
                    $(parent).children(".ul-level-2").removeClass("block");
                    $(parent).removeClass("active");
                    return;
                }

                $(parent).children(".ul-level-2").addClass("block");
                $(parent).addClass("active");
            });


            /**
             * 新建链接
             */
            $(document).on("click","#new-link-btn",function () {
                $.each($("#add-link-modal input[type='text']"),function () {
                    var value = $(this).attr("defaut-value");
                    $(this).val(value);
                });
                $("#add-link-modal").modal('show');
            });


            $(document).on("click",".control-checkbox",function () {

                var target = $(this).attr("target");
                if ($(this).is(":checked")){
                    $("."+target).removeClass("hidden");
                }else {
                    $("."+target).addClass("hidden");
                }

            });

            $(document).on("click",".check-all",function () {
                if ($(this).hasClass("icon-check-empty")){
                    // 选中所有
                    $(this).removeClass("icon-check-empty").addClass("icon-check");
                    $(this).parent().siblings().find(".can-check").removeClass("icon-check-empty").addClass("icon-check");
                    return false;
                }

                // 取消所有
                $(this).removeClass("icon-check").addClass("icon-check-empty");
                $(this).parent().siblings().find(".can-check").removeClass("icon-check").addClass("icon-check-empty");
                return false;
            });

            $(document).on("click",".can-check",function () {
                if (!$(this).hasClass("check-all")){

                    if ($(this).hasClass("icon-check-empty")){
                        $(this).removeClass("icon-check-empty").addClass("icon-check");

                        // 判断 是否全选也该选中
                        //                         a      li
                        var siblings = $(this).parent().parent().siblings();
                        var tableCount = siblings.length;
                        var checkCount = siblings.find(".icon-check").length;

                        if (tableCount == checkCount){
                            $(this).parent().parent().parent().siblings().find(".check-all")
                                .removeClass("icon-check-empty").addClass("icon-check");
                        }
                    }else {
                        $(this).removeClass("icon-check").addClass("icon-check-empty");
                        // 判断 是否全选也该取消

                        var siblings = $(this).parent().parent().siblings();
                        var tableCount = siblings.length;
                        var checkEmptyCount = siblings.find(".icon-check-empty").length;

                        if (tableCount != checkEmptyCount){
                            $(this).parent().parent().parent().siblings().find(".check-all")
                                .removeClass("icon-check").addClass("icon-check-empty");
                        }
                    }
                }
                return false;
            });



            /**
             * 新增链接确认
             */
            $(document).on("click","#save-link-btn",function () {

                var data = {};
                $.each($("#add-link-modal input[type='text']"),function () {
                    var name = $(this).attr("name");
                    var value = $.trim($(this).val());
                    data[name] = value;
                });

                console.log(JSON.stringify(data));

                saveLink(JSON.stringify(data));

            });

            /**
             * 编辑链接
             */
            $(document).on("click",".edit-link-btn",function () {
                var linkId = $(this).parent().attr("link-id");
                $("#editlink-id").val(linkId);
                console.log("link-id = " + linkId);

                var name = $.trim($(this).parent().find(".menu-text").text());

                console.log("name = " + name);
                $("#edit-link-name").val(name);

                $("#edit-link-modal").modal('show');
                return false;
            });

            /**
             * 编辑链接确认
             */
            $(document).on("click","#btn-edit-link-sure",function () {
                var linkId = $("#editlink-id").val();

                var name = $("#edit-link-name").val();

                var data = {
                    id:linkId,
                    name:name
                };

                updateLink(JSON.stringify(data));
                return false;
            });



            /**
             * 删除链接
             */
            $(document).on("click",".delete-link-btn",function () {
                var id = $(this).parent().attr("link-id");
                var name = $.trim($(this).parent().find("span").text());
                $("#delete-link-id").val(id)
                $("#delete-link-name").html(name);
                $("#delete-link-modal").modal('show');
                return false;
            });

            /**
             * 删除链接确认
             */
            $(document).on("click","#btn_deleteMenu",function () {
                var id = $("#delete-link-id").val();
                deleteLink(id);
                return false;
            });


            /**
             * 保存配置按钮
             */
            $(document).on("click",".save-settings-btn",function () {
                // var data = '{"project":{"projectPackage":"按时打算","codePath":"撒谎","useLombok":true,"createService":false,"createController":true},"entity":{"entityPackage":"阿生","baseClassFullName":"","equalAndHash":false,"toString":true,"noArgConstructor":false,"chain":false,"useJdk8Time":false,"useBaseClass":false},"mapper":{"mapperPackage":"","mapperSufix":"Mapper","extendBaseMapper":false,"useMapperAnonntation":false},"service":{"servicePackage":"","createInterface":false,"useBaseService":false},"controller":{"controllerPackage":"","methodReturnTypeFullName":"","returnTypeStaticMethod":"","useRestful":false}}';
                $("#save-settings-modal").modal('show');
            });


            /**
             * 保存配置确认
             */
            $(document).on("click","#btn-save-settings-sure",function () {
                var linkId = $("#settings-link-id").val();
                if (!linkId){
                    return false;
                }
                var settings = getViewSettings();
                console.log(JSON.stringify(settings));
                var name = $.trim($("#settings-name").val());
                var data = {
                    settings:settings,
                    name:name,
                    linkId:linkId
                };
                saveSettings(JSON.stringify(data));
                return false;
            });

            /**
             * 加载配置按钮
             */
            $(document).on("click",".load-setting-btn",function () {
                var id = $(this).parent().attr("link-id");
                loadSettings(id);
                return false;
            });

            /**
             * 加载配置确认
             */
            $(document).on("click","#btn-load-settings-sure",function () {
                var id = $("#choose-settings-select").val();
                console.log(id);
                loadSettingDetail(id);
                return false;
            });



            $(document).on("click",".btn-mapping",function () {
                $("#mapping-modal").modal("show");
                return false;
            });

            /* 刷新 */
            $(document).on("click",".flush-btn",function () {
                location.reload(true);
            });

            /**
             * 生成代码按钮
             */
            $(document).on("click",".create-code-btn",function () {

                console.log("生成代码");
                var id = $(".li-level-1.active").find(".a-level-1").attr("link-id");
                var databases=[];
                var dbs = $(".li-level-1.active").find(".db-name");

                $.each(dbs,function () {

                    var tables = [];

                    var ts = $(this).parent().siblings().find(".icon-check");

                    $.each(ts,function () {
                        var tName = $.trim($(this).parent().find(".table-name").text());
                        var table = {
                            table:tName
                        };
                        tables.push(table);
                    });



                    if (tables.length>0){
                        var database = {
                            database:$.trim($(this).text()),
                            tables:tables
                        };
                        databases.push(database);
                    }

                });

                if (databases.length>0){
                    var settings = getViewSettings();
                    var data = {
                        id:id,
                        databases:databases,
                        settings:settings
                    };

                    console.log(JSON.stringify(data));
                    createCode(JSON.stringify(data));
                }

                return false;
            });


            setTimeout(function () {
                console.log(window.webEngine);
                loadLinks();
            },500);


        });

        /* 保存数据库配置 */
        function saveSettings(data) {
            window.webEngine.saveSettings(data);
        }

        /* 保存数据库配置回调 */
        function saveSettingsCallback(data) {
            $(".btn-default").click();
        }

        /* 加载配置 */
        function loadSettings(id) {
            window.webEngine.loadSettings(id);
        }

        function loadSettingDetail(id) {
            window.webEngine.loadSettingDetail(id);
        }

        function loadSettingDetailCallback(data) {
            setViewSettings(JSON.parse(data));
            $(".btn-default").click();
        }



        /* 加载配置回调 */
        function loadSettingsCallback(data) {
            console.log(data)
            var json = JSON.parse(data);

            var html = "";
            $.each(json,function () {
                var name = this.name;
                var id = this.id;
                console.log("name="+name+",id=" + id);
                html += "<option value='"+ id+"'>"+name+"</option>";
                console.log(html)
            });

            if (html){
                $("#choose-settings-select").empty().append(html);
            }
            $("#choose-settings-modal").modal('show');

        }


        /* 加载数据库链接 */
        function loadLinks() {
            try{
                window.webEngine.loadLinks();

            }catch (e) {
                $(".li-level-1").parent().removeClass("hidden");
                console.log(e);
            }
        }

        /* 加载数据库链接回调 */
        function loadLinksCallback(data) {
            $("#sidebar").append(data);
        }

        /* 更新数据库链接 */
        function updateLink(data) {
            window.webEngine.updateLink(data);
        }

        /* 更新数据库链接回调 */
        function updateLinkCallback(data) {
            var obj = JSON.parse(data);
            $(".a-level-1[link-id='"+obj.id+"']").find("span").text(obj.name);
            $(".btn-default").click();
        }

        /* 更新数据库链接 */
        function saveLink(data) {
            window.webEngine.saveLink(data);
        }

        /* 保存数据库链接 */
        function saveLinkCallback(data) {
            $("#sidebar").append(data);
            $(".btn-default").click();
        }

        /* 删除数据库链接 */
        function deleteLink(id) {
            window.webEngine.deleteLink(id);
        }

        /* 删除数据库链接回调 */
        function deleteLinkCallback(id) {
            $(".a-level-1[link-id='"+id+"']").parent().parent().remove();
            $(".btn-default").click();
        }

        /* 加载当前链接下的数据库 */
        function loadDatabases(id) {
            window.webEngine.loadDatabases(id);
        }

        /* 加载当前链接下的数据库回调 */
        function loadDatabasesCallback(id,data) {
            $(".a-level-1[link-id='"+id+"']").siblings().remove();
            $(".a-level-1[link-id='"+id+"']").parent().append(data);
            $(".btn-default").click();
        }

        /* 生成代码 */
        function createCode(data) {
            window.webEngine.createCode(data);
        }

        /* 生成代码回调 */
        function createCodeCallback() {
            $("#tip-modal").modal("show");
        }

        function loadDefaultMappings(id) {
            window.webEngine.loadDefaultMappings(id);
        }

        function loadDefaultMappingsCallback(data) {
            $(".mapping-content").empty().append(data);
        }



        function setViewSettings(data){
            for (var type in data){
                var typeSettings = data[type];
                for (var name in typeSettings){
                    var inputType = $("input[name='"+name+"']").attr("type");
                    if (inputType=="text"){
                        $("input[name='"+name+"']").val(typeSettings[name]);
                    }else if (inputType=="checkbox") {
                        if (typeSettings[name]){//选中
                            if (!$("input[name='"+name+"']").is(":checked")){
                                $("input[name='"+name+"']").click();
                            }
                        }else {
                            //没选中
                            if ($("input[name='"+name+"']").is(":checked")){
                                $("input[name='"+name+"']").click();
                            }
                        }
                    }else {
                        console.log("未知类型");
                    }
                }
            }
            setMappings(data);

        }

        function getViewSettings() {
            var data = {};
            $.each($(".group"),function () {
                var type = $(this).attr("group-type");
                var typeSettings={};
                data[type] = typeSettings;

                $.each($(this).find("input[type='text']"),function () {
                    var name = $(this).attr("name");
                    var value = $.trim($(this).val());
                    typeSettings[name] = value;
                });

                $.each($(this).find("input[type='checkbox']"),function () {
                    var name = $(this).attr("name");
                    if ($(this).is(":checked")){
                        typeSettings[name] = true;
                    }else {
                        typeSettings[name] = false;
                    }
                });
            });
            var mappings = getMappings();
            console.log(JSON.stringify(data));
            data.entity.mapping = mappings;
            return data;
        }

        function getMappings() {
            var mappings = [];
            var columnTyps = $("#mapping-modal").find("input[type='hidden']");
            $.each(columnTyps,function () {
                var columnTypeId = $(this).parent().parent().find("label").attr("target");
                var javaTypeId = $(this).val();
                var mapping = {
                    columnTypeId:columnTypeId,
                    javaTypeId:javaTypeId
                };
                mappings.push(mapping);
            });
            return mappings;
        }

        function setMappings(data) {
            var mappings = data.entity.mapping;

            $.each(mappings,function () {
                var columnTypeId = this.columnTypeId;
                var javaType = this.fullName;
                var javaTypeId =  this.javaTypeId;
                var div = $("#mapping-modal").find("label[target='"+columnTypeId+"']").parent();

                $(div).find("input").val(javaTypeId);
                $(div).find(".java-type").text(javaType);

            });
        }

    </script>

</head>
<body style="height: 100%; overflow-x: hidden; ">
<div class="main-container" id="main-container">

    <div class="row">

        <div class="col-md-3">
            <div class="left" id="sidebar">
                <ul class="nav nav-list">
                    <li id="menulist" class="nav_forfind">
                        <a  id="new-link-btn">
                            <span class="menu-text">新建链接 </span>
                        </a>
                    </li>
                </ul>

                <!-- 一级菜单 -->
                <ul class="nav nav-list hidden">
                    <li class="nav_forfind li-level-1" style="z-index:1;">
                        <a  class="a-level-1" link-id="-100">
                            <i class="icon-link"></i>
                            <span class="menu-text" >本机</span>
                            <i class="icon-trash red click-able delete-link-btn" title="删除"></i>
                            <i class="icon-edit green click-able edit-link-btn" title="修改"></i>
                            <i class="icon-cogs blue click-able load-setting-btn" title="加载配置"></i>
                            <b class="arrow icon-angle-down"></b>
                        </a>

                        <!-- 二级菜单 -->
                        <ul class="submenu ul-level-2">
                            <li class="open li-level-2">
                                <a  class="a-level-2">
                                    <i class="icon-double-angle-right"></i>
                                    <i class="icon-align-justify"></i>
                                    <span class="db-name">test</span>
                                    <i class="icon-check-empty can-check click-able blue check-all" title="全选"></i>
                                </a>


                                <!-- 三级菜单 -->
                                <ul class="submenu ul-level-3">
                                    <li class="li-level-3">
                                        <a  class="none-decoration">
                                            <i class="icon-list blue"></i>
                                            <span class="table-name">t_user</span>
                                            <i class="icon-check  can-check  blue click-able"></i>
                                        </a>
                                    </li>
                                    <li class="li-level-3">
                                        <a  class="none-decoration">
                                            <i class="icon-list blue"></i>
                                            <span class="table-name">t_order</span>
                                            <i class="icon-check-empty can-check blue click-able"></i>
                                        </a>
                                    </li>
                                </ul>
                                <!-- 三级菜单 -->
                            </li>
                        </ul>
                        <!-- 二级菜单 -->


                        <!-- 二级菜单 -->
                        <ul class="submenu ul-level-2">
                            <li class="open li-level-2">
                                <a  class="a-level-2">
                                    <i class="icon-double-angle-right"></i>
                                    <i class="icon-align-justify"></i>
                                    <span style="cursor: pointer;" >test</span>
                                    <i class="icon-check-empty  can-check  click-able blue check-all" title="全选"></i>
                                </a>


                                <!-- 三级菜单 -->
                                <ul class="submenu ul-level-3">
                                    <li class="li-level-3">
                                        <a  class="none-decoration">
                                            <i class="icon-list blue"></i>
                                            <span class="table-name">t_user</span>
                                            <i class="icon-check can-check  blue click-able"></i>
                                        </a>
                                    </li>
                                    <li class="li-level-3">
                                        <a  class="none-decoration">
                                            <i class="icon-list blue"></i>
                                            <span class="table-name">t_order</span>
                                            <i class="icon-check-empty can-check blue click-able"></i>
                                        </a>
                                    </li>
                                </ul>
                                <!-- 三级菜单 -->
                            </li>
                        </ul>
                        <!-- 二级菜单 -->
                    </li>
                </ul>
                <!-- 一级菜单 -->
            </div>
        </div>

        <div class="col-md-9" id="page-content">
            <div class="main-content" >
                <div class="pagecontent" >


                    <div class="group project-group" group-type="project">
                        <h3 class="header smaller lighter blue">项目配置</h3>
                        <div class="row monitor-row">

                            <div class="col-sm-4">
                                <label class="col-sm-6 align-right">项目包名：</label>
                                <div class="col-sm-6">
                                    <input placeholder="项目包名" type="text" name="projectPackage"/>
                                </div>
                            </div>

                            <div class="col-sm-4">
                                <label class="col-sm-6 align-right">代码路径：</label>
                                <div class="col-sm-6">
                                    <input placeholder="代码路径" type="text" name="codePath"/>
                                </div>
                            </div>

                        </div>

                        <div class="row monitor-row check-row">
                            <div class="col-sm-2">
                                <label class="control-label align-right">lombok注解：</label>
                                <input type="checkbox" checked="checked" name="useLombok"/>
                            </div>

                            <div class="col-sm-2">
                                <label class="control-label align-right">生成service：</label>
                                <input type="checkbox" name="createService" class="control-checkbox" target="service-group" checked="checked"/>
                            </div>

                            <div class="col-sm-2" style="padding-right: 0">
                                <label class="control-label align-right">生成controller：</label>
                                <input type="checkbox" name="createController" class="control-checkbox" target="controller-group" checked="checked"/>
                            </div>

                            <div class="col-sm-4">
                                <label class="control-label align-right" style="padding-top: 5px">去表前缀：</label>
                                <input placeholder="表前缀" type="text" name="tablePrefix"/>
                            </div>
                        </div>

                    </div>



                    <div class="group entity-group" group-type="entity">
                        <h3 class="header smaller lighter blue">entity配置</h3>
                        <div class="row monitor-row">
                            <div class="col-sm-4">
                                <label class="col-sm-6 align-right">包名：</label>
                                <div class="col-sm-6">
                                    <input placeholder="entity包名" value="entity" type="text" name="entityPackage"/>
                                </div>
                            </div>
                            <div class="col-sm-3" style="margin-left:0%">
                                <label class="col-sm-4 align-right" style="padding-right:12px;padding-left: 0px">主键名：</label>
                                <div class="col-sm-8">
                                    <input placeholder="主键名" type="text" value="id" name="primaryKeyName"/>
                                </div>
                            </div>
                            <div class="col-sm-5" style="margin-left:-5%">
                                <label class="col-sm-4 align-right">主键类型：</label>
                                <div class="col-sm-8" style="margin-top: 0">
                                    <input placeholder="主键类型" type="text" name="primaryKeyType" value="java.lang.Long" />
                                    <button type="button" style="padding:0"  class="btn btn-primary btn-mapping"> 类型映射 </button>
                                </div>
                            </div>

                        </div>

                        <div class="row monitor-row check-row">
                            <div class="col-sm-2">
                                <label class="control-label align-right">equal&hash：</label>
                                <input type="checkbox" checked="checked" name="equalAndHash"/>
                            </div>

                            <div class="col-sm-2">
                                <label class="control-label align-right">toString：</label>
                                <input  type="checkbox" checked="checked" name="toString"/>
                            </div>

                            <div class="col-sm-2">
                                <label class="control-label align-right">无参构造：</label>
                                <input type="checkbox" checked="checked" name="noArgConstructor"/>
                            </div>
                            <div class="col-sm-2">
                                <label class="control-label align-right">链式调用：</label>
                                <input type="checkbox" checked="checked" name="chain"/>
                            </div>

                            <div class="col-sm-2">
                                <label class="control-label align-right">继承超类：</label>
                                <input type="checkbox" name="useBaseClass" class="control-checkbox" target="use-base-class"/>
                            </div>

                            <div class="col-sm-2 exclude">
                                <label class="control-label align-right" style="margin-bottom: 0 ;padding: 0 0 0 0">排除字段：</label>
                                <input type="text" style="width: 58%" name="excludeColumns" class="control-checkbox" placeholder="用,分隔"/>
                            </div>
                        </div>

                        <div class="row monitor-row use-base-class hidden">
                            <div class="col-sm-4">
                                <label class="col-sm-6 align-right">超类：</label>
                                <div class="col-sm-6">
                                    <input placeholder="超类全类名" type="text" name="baseClassFullName"/>
                                </div>
                            </div>

                        </div>
                    </div>


                    <div class="group mapper-group" group-type="mapper">
                        <h3 class="header smaller lighter blue">mapper配置</h3>
                        <div class="row monitor-row">
                            <div class="col-sm-4">
                                <label class="col-sm-6 align-right">包名：</label>
                                <div class="col-sm-6">
                                    <input placeholder="mapper包名" value="mapper" type="text" name="mapperPackage"/>
                                </div>
                            </div>
                            <div class="col-sm-4">
                                <label class="col-sm-6 align-right">类名后缀：</label>
                                <div class="col-sm-6">
                                    <input placeholder="类名后缀" value="Mapper" type="text" name="mapperSufix"/>
                                </div>
                            </div>
                        </div>

                        <div class="row monitor-row check-row">
                            <div class="col-sm-3">
                                <label class="control-label align-right">继承基础Mapper：</label>
                                <input type="checkbox" checked="checked" name="extendBaseMapper"/>
                            </div>
                            <div class="col-sm-3">
                                <label class="control-label align-right">使用@Mapper：</label>
                                <input type="checkbox" checked="checked" name="useMapperAnonntation"/>
                            </div>
                        </div>
                    </div>

                    <div class="group service-group" group-type="service">
                        <h3 class="header smaller lighter blue">service配置</h3>
                        <div class="row monitor-row">
                            <div class="col-sm-4">
                                <label class="col-sm-6 align-right">包名：</label>
                                <div class="col-sm-6">
                                    <input placeholder="service包名" value="service" type="text" name="servicePackage"/>
                                </div>
                            </div>
                        </div>
                        <div class="row monitor-row check-row">
                            <div class="col-sm-3">
                                <label class="control-label align-right">创建接口：</label>
                                <input type="checkbox" checked="checked" name="createInterface"/>
                            </div>
                            <div class="col-sm-3">
                                <label class="control-label align-right">使用基础Service：</label>
                                <input type="checkbox" checked="checked" name="useBaseService"/>
                            </div>
                            <div class="col-sm-3">
                                <label class="control-label align-right">事务注解：</label>
                                <input type="checkbox" checked="checked" name="useTransactional"/>
                            </div>
                        </div>
                    </div>


                    <div class="group controller-group" group-type="controller">
                        <h3 class="header smaller lighter blue">controller配置</h3>
                        <div class="row monitor-row">
                            <div class="col-sm-4">
                                <label class="col-sm-6 align-right">包名：</label>
                                <div class="col-sm-6">
                                    <input placeholder="controller包名" value="web" type="text" name="controllerPackage"/>
                                </div>
                            </div>

                            <div class="col-sm-4">
                                <label class="col-sm-6 align-right">返回值全类名：</label>
                                <div class="col-sm-6">
                                    <input placeholder="默认ModelAndView" type="text" name="methodReturnTypeFullName"/>
                                </div>
                            </div>
                        </div>

                        <div class="row monitor-row check-row">
                            <div class="col-sm-3">
                                <label class="control-label align-right">使用restful：</label>
                                <input type="checkbox" name="useRestful"/>
                            </div>

                            <div class="col-sm-6" style="padding-top: 5px">
                                <label class="control-label align-right">返回值类型静态方法名：</label>
                                <input type="text" name="returnTypeStaticMethod" placeholder="方法名"/>
                            </div>
                        </div>
                    </div>
                    <hr/>
                    <div class="row center">
                      <!--  <button type="button"  class="btn btn-primary flush-btn" > 刷新 </button>  -->
                        <button type="button"  class="btn btn-primary save-settings-btn" > 保存配置 </button>
                        <button type="button"  class="btn btn-primary create-code-btn"> 生成代码 </button>

                    </div>



                </div>
            </div>
        </div>

    </div>









    <!--新增链接模态框 -->
    <div class="modal fade" id="add-link-modal" tabindex="-1"
         role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                    <h4 class="modal-title">新增链接</h4>
                </div>
                <div class="modal-body">
                    <form class="form-horizontal">
                        <input name="id" id="" type="hidden"/>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">名称：</label>
                            <div class="col-sm-8">
                                <input class="form-control" name="name" placeholder="名称" value="新数据库链接" defaut-value="新数据库链接" maxlength="20" type="text"/>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">数据库：</label>
                            <div class="col-sm-8">
                                <input class="form-control" name="databaseType" value="mysql" disabled="disabled" defaut-value="mysql" placeholder="数据库" type="text"/>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">主机：</label>
                            <div class="col-sm-8">
                                <input class="form-control" name="host" placeholder="主机" value="127.0.0.1" defaut-value="127.0.0.1" type="text"/>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">端口：</label>
                            <div class="col-sm-8">
                                <input class="form-control useradd" name="port" placeholder="端口" value="3306" defaut-value="3306" type="text"/>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">用户：</label>
                            <div class="col-sm-8">
                                <input class="form-control useradd" name="user" placeholder="用户" value="root" defaut-value="root" type="text"/>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">密码：</label>
                            <div class="col-sm-8">
                                <input class="form-control" name="password" id="add-link-password" placeholder="密码" value="root" defaut-value="root" type="text"/>
                            </div>
                        </div>

                        <div class="modal-footer">

                            <button type="button" id="save-link-btn" class="btn btn-primary">
                                <i class="icon-ok"></i>确定
                            </button>
                            <button type="button" class="btn btn-default" data-dismiss="modal">
                                <i class="icon-remove"></i>关闭
                            </button>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>


    <!--编辑链接模态框 -->
    <div class="modal fade" id="edit-link-modal" tabindex="-1"
         role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                    <h4 class="modal-title">编辑链接</h4>
                </div>
                <div class="modal-body">
                    <form class="form-horizontal">
                        <input name="id" id="editlink-id" type="hidden"/>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">名称：</label>
                            <div class="col-sm-8">
                                <input class="form-control" id="edit-link-name" placeholder="名称" maxlength="20" type="text"/>
                            </div>
                        </div>

                        <div class="modal-footer">

                            <button type="button" id="btn-edit-link-sure" class="btn btn-primary">
                                <i class="icon-ok"></i>确定
                            </button>
                            <button type="button" class="btn btn-default" data-dismiss="modal">
                                <i class="icon-remove"></i>关闭
                            </button>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>


    <!--字段映射态框 -->
    <div class="modal fade" id="mapping-modal" tabindex="-1"
         role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog" style="width: 400px;">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                    <h4 class="modal-title">字段映射</h4>
                </div>
                <div class="modal-body">
                    <form class="form-horizontal">

                        <div class="mapping-content">

                        </div>


                        <div class="modal-footer">
                            <button type="button" id="btn-mapping-sure" class="btn btn-primary">
                                <i class="icon-ok"></i>确定
                            </button>
                            <button type="button" class="btn btn-default" data-dismiss="modal">
                                <i class="icon-remove"></i>关闭
                            </button>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>


    <!--编辑链接模态框 -->
    <div class="modal fade" id="save-settings-modal" tabindex="-1"
         role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                    <h4 class="modal-title">保存配置</h4>
                </div>
                <div class="modal-body">
                    <form class="form-horizontal">
                        <div class="form-group">
                            <label class="col-sm-3 control-label">配置名称：</label>
                            <div class="col-sm-8">
                                <input class="form-control" id="settings-name" placeholder="配置名称" maxlength="20" type="text"/>
                                <input class="form-control" id="settings-link-id" type="hidden"/>
                            </div>
                        </div>

                        <div class="modal-footer">

                            <button type="button" id="btn-save-settings-sure" class="btn btn-primary">
                                <i class="icon-ok"></i>确定
                            </button>
                            <button type="button" class="btn btn-default" data-dismiss="modal">
                                <i class="icon-remove"></i>关闭
                            </button>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>

    <!--选择加载配置模态框 -->
    <div class="modal fade" id="choose-settings-modal" tabindex="-1"
         role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                    <h4 class="modal-title">选择加载配置</h4>
                </div>
                <div class="modal-body">
                    <form class="form-horizontal">

                        <div class="form-group">
                            <label class="col-sm-3 control-label">配置名称：</label>

                            <div class="col-sm-8">
                                <select class="form-control" name="type" id="choose-settings-select">
                                    <option value="">没有配置</option>
                                </select>
                            </div>
                        </div>

                        <div class="modal-footer">

                            <button type="button" id="btn-load-settings-sure" class="btn btn-primary">
                                <i class="icon-ok"></i>确定
                            </button>
                            <button type="button" class="btn btn-default" data-dismiss="modal">
                                <i class="icon-remove"></i>关闭
                            </button>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>

    <!--删除链接模态框 -->
    <div class="modal fade" id="delete-link-modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                    <h4 class="modal-title">删除链接</h4>
                </div>
                <div class="modal-body">
                    <form class="form-horizontal" method="post" id="delete_menu_form" action="delete">
                        <input name="id" id="delete-link-id" type="hidden"/>
                    </form>
                    <div class="center">
                        删除链接
                        <span class="red" style="font-size: 20px" id="delete-link-name"></span>,您确定这么做吗?
                    </div>
                    <div class="modal-footer">
                        <button type="button" id="btn_deleteMenu" class="btn btn-primary">
                            <i class="icon-ok"></i>确定
                        </button>
                        <button type="button" class="btn btn-default" data-dismiss="modal">
                            <i class="icon-remove"></i>关闭
                        </button>
                    </div>

                </div>
            </div>
        </div>
    </div>


    <!-- 提示模态框 -->
    <div class="modal fade" id="tip-modal" tabindex="-1"
         role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal"
                            aria-hidden="true">×</button>
                    <h4 class="modal-title">消息提示</h4>
                </div>
                <div class="modal-body">
                    <form class="form-horizontal" method="post">
                    </form>
                    <div class="center">
					<span class="green" style="font-size: 20px">代码生成完毕!</span>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-primary" data-dismiss="modal">
                            <i class="icon-remove"></i>关闭
                        </button>
                    </div>

                </div>
            </div>
        </div>
    </div>
    <!-- 提示模态框结束 -->

</div>
</body>
</html>